package file;

import java.io.File;
import java.io.FileFilter;

public class ListFile {
    public static void main(String[] args) {
        File file=new File(".");
        if(file.isDirectory()){
            FileFilter fiter=new FileFilter() {

                public boolean accept(File file) {
                        String name=file.getName();
                    return name.endsWith(".txt");
                }
            };
            File[] subs=file.listFiles(fiter);
            for(File sub:subs){
                System.out.println(sub.getName());
            }
        }
    }
}
